package com.cskaoyan.controller;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.WxCatalogIndexVo;
import com.cskaoyan.bean.vo.wx_catalog_current.WxCatalogCurrentVo;
import com.cskaoyan.service.WxCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Trellis
 * @since 2022/09/08 17:39
 */
@RestController
@RequestMapping("wx/catalog")
public class WxCatalogController {

    @Autowired
    WxCatalogService wxCatalogService;

    @RequestMapping("current")
    public BaseRespVo current(Integer id) {
        WxCatalogCurrentVo wxCatalogCurrentVo = wxCatalogService.selectById(id);
        BaseRespVo baseRespVo = BaseRespVo.ok(wxCatalogCurrentVo);
        return baseRespVo;
    }


    @RequestMapping("index")
    public BaseRespVo index() {
        WxCatalogIndexVo wxCatalogIndexVo = wxCatalogService.selectAll();
        BaseRespVo baseRespVo = BaseRespVo.ok(wxCatalogIndexVo);
        return baseRespVo;
    }
}
